﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Xml.Linq;
using SES.CMS.BL;
using SES.CMS.AdminCP;
using SES.CMS.DO;

namespace SES.CMS
{
    public partial class checkout : BasePage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["IDDN"] != null)
            {
                Response.Redirect("/ThanhToan.aspx");
            }
        }

        protected void btnRegister_Click(object sender, EventArgs e)
        {
            Response.Redirect("/Register.aspx");
            Session["Register"] = "BuyWithRegister";
        }
        protected void btnLogin_Click(object sender, EventArgs e)
        {
            string txtPass = Ultility.EncryptMd5(txtPassword.Text);
            ClientLoginDO obj = new ClientLoginBL().SelectLogin(txtEmail.Text, txtPass);
            if (obj.ClientLoginID > 0)
            {
                Session["TenDN"] = txtEmail.Text;
                Session["IDDN"] = obj.ClientLoginID.ToString();
                Session["ClientName"] = obj.ClientName.ToString();
                Ultility.Alert("Bạn đã đăng nhập thành công!!!", "/ThanhToan.aspx");
            }
            else
            {
                Ultility.Alert("Đăng nhập thất bại!!!", "Checkout.aspx");
            }
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            Response.Redirect("/ThanhToan.aspx");
            Session["Register"] = "BuyWithoutRegister";
        }
    }
}
